import java.util.Scanner;
class A {

}

class B extends A{

}
class C extends  B{

}
public class Main {
    public static void main(String[] args) {
        A a0 = new A();
        A a1 = new B();
        A a2 = new C();
    }
}

class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for(int i = 0; i<n; i++) {
            nums[i] = scanner.nextInt();
        }
        int i = 0,ret = 0;
        while(i<n) {
            int j = i,k = i;
            while(j+1<n && nums[j+1] >= nums[j]) {
                j++;
            }
            while(k+1<n && nums[k+1] <= nums[k]) {
                k++;
            }
            i = Math.max(j,k)+1;
            ret++;
        }
        System.out.println(ret);
    }

    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        char[] s = str.toCharArray();
        reverse(s,0,s.length-1);
        int i = 0;
        while(i<s.length) {
            int j = i;
            while(j<s.length && s[j]!=' ') {
                j++;
            }
            reverse(s,i,j-1);
            i = j+1;
        }
        System.out.println(s);
    }
    public static void reverse(char[] str,int begin,int end) {
        int n = str.length;
        for(int i = begin, j = end; i<j; i++,j--) {
            char t = str[i];
            str[i] = str[j];
            str[j] = t;
        }
    }
}
